package pieces;

import java.util.ArrayList;
import model.*;

public class Knight extends Piece
{
	public Knight(Location loc, GridGame<Piece> grid, int color)
	{
		super(loc, grid, KNIGHT, color);
	}
	@Override
	public ArrayList<Location> getMoveLocations()
	{
		ArrayList<Location> locs = new ArrayList<Location>();
		locs.add(new Location(currentLoc.getRow() - 2, currentLoc.getCol() + 1));
		locs.add(new Location(currentLoc.getRow() - 2, currentLoc.getCol() - 1));
		locs.add(new Location(currentLoc.getRow() + 2, currentLoc.getCol() - 1));
		locs.add(new Location(currentLoc.getRow() + 2, currentLoc.getCol() + 1));
		locs.add(new Location(currentLoc.getRow() - 1, currentLoc.getCol() + 2));
		locs.add(new Location(currentLoc.getRow() - 1, currentLoc.getCol() - 2));
		locs.add(new Location(currentLoc.getRow() + 1, currentLoc.getCol() - 2));
		locs.add(new Location(currentLoc.getRow() + 1, currentLoc.getCol() + 2));
		ArrayList<Location> returned = new ArrayList<Location>();
		for (Location loc:locs)
		{
			if (loc != null && grid.inBounds(loc))
				returned.add(loc);
		}
		return returned;
	}
	@Override
	public int getValue()
	{
		return KNIGHT_VALUE;
	}
}
